<?php defined('SYSPATH') or die('No direct script access.');
 
class Model_Banners extends ORM {
	protected $_table_name = 'banners';

	public function get_right() {
		$postfix = Controller_Common::$postfix;

		return DB::select('id', array('title'.$postfix, 'title'), 'link', 'image', 'image_params', 'sort')
			->from($this->_table_name)
			->order_by('sort', 'DESC')
			->where('image_params', '=', '0')
			->as_object()
			->execute();
	}

	public function get_bot() {
		$postfix = Controller_Common::$postfix;

		return DB::select('id', array('title'.$postfix, 'title'), 'link', 'image', 'image_params', 'sort')
			->from($this->_table_name)
			->where('image_params', '=', '1')
			->as_object()
			->execute()
			->current();
	}

}